﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface IZGRepository
    {

        /// <summary>
        /// 根据职工名获取用户
        /// </summary>
        /// <param name="name">职工名</param>
        ZG Get(string name);

        /// <summary>
        /// 根据职工Id获取用户 
        /// </summary>
        /// <param name="zgId">职工Id</param>
        ZG Get(int zgId);

        /// <summary>
        /// 获取职工信息
        /// </summary>
        /// <param name="start">开始页码</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<ZG> GetAll(int start, int takeSize);

        /// <summary>
        /// 添加新职工
        /// </summary>
        /// <param name="zg">职工对象</param>
        ZG Add(ZG zg);

        /// <summary>
        /// 更新职工信息
        /// </summary>
        /// <param name="zgId">职工Id</param>
        /// <param name="update">包含更新操作的方法</param>
        ZG Update(int zgId, Action<ZG> update);

        /// <summary>
        /// 删除职工信息
        /// </summary>
        /// <param name="zgId">职工Id</param>
        bool Delete(int zgId);

        /// <summary>
        /// 是否存在同名职工
        /// </summary>
        /// <param name="name">职工姓名</param>
        bool IsExists(string name);

        /// <summary>
        /// 统计职工人数
        /// </summary>
        int Count();
    }
}